<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>商品列表 - 社交商城</title>
  <!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
  
  <style>
    /* 基础样式 */
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      background-color: #f5f7fa;
      color: #333;
      margin: 0;
      padding-bottom: 60px;
    }
    
    /* 顶部导航 */
    .top-nav {
      height: 50px;
      background-color: #fff;
      border-bottom: 1px solid #eee;
      display: flex;
      align-items: center;
      padding: 0 15px;
      position: sticky;
      top: 0;
      z-index: 100;
    }
    
    .nav-title {
      font-size: 18px;
      font-weight: 600;
      margin: 0 auto;
    }
    
    .nav-btn {
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #666;
      text-decoration: none;
    }
    
    .nav-btn.primary {
      color: #ff4d4f;
    }
    
    /* 搜索栏 */
    .search-bar {
      padding: 10px 15px;
      background-color: #fff;
      border-bottom: 1px solid #eee;
    }
    
    .search-input {
      width: 100%;
      padding: 10px 15px;
      border-radius: 8px;
      border: 1px solid #eee;
      background-color: #f5f7fa;
      font-size: 14px;
      outline: none;
    }
    
    /* 样式切换器 */
    .style-switcher {
      background-color: #fff;
      padding: 10px 15px;
      border-bottom: 1px solid #eee;
    }
    
    .style-tabs {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding-bottom: 5px;
    }
    
    .style-tabs::-webkit-scrollbar {
      display: none;
    }
    
    .style-tab {
      padding: 6px 14px;
      background-color: #f5f7fa;
      border-radius: 20px;
      font-size: 14px;
      white-space: nowrap;
      cursor: pointer;
    }
    
    .style-tab.active {
      background-color: #ff4d4f;
      color: white;
    }
    
    /* 分类筛选 */
    .category-filter {
      background-color: #fff;
      padding: 10px 0;
      overflow-x: auto;
      border-bottom: 1px solid #eee;
    }
    
    .category-tabs {
      display: flex;
      min-width: 100%;
      padding: 0 15px;
    }
    
    .category-tab {
      padding: 5px 15px;
      font-size: 14px;
      white-space: nowrap;
      color: #666;
      border-bottom: 2px solid transparent;
    }
    
    .category-tab.active {
      color: #ff4d4f;
      border-bottom-color: #ff4d4f;
      font-weight: 500;
    }
    
    /* 通用商品页面样式 */
    .products-page {
      display: none;
    }
    
    .products-page.active {
      display: block;
    }
    
    /* 商品列表容器 */
    .products-container {
      padding: 10px;
    }
    
    /* 商品项基础样式 */
    .product-item {
      background-color: #fff;
      border-radius: 8px;
      overflow: hidden;
      margin-bottom: 10px;
      position: relative;
    }
    
    .product-image {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
    }
    
    .product-info {
      padding: 10px;
    }
    
    .product-title {
      font-size: 14px;
      line-height: 1.4;
      margin-bottom: 5px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    
    .product-price {
      color: #ff4d4f;
      font-weight: 600;
      font-size: 16px;
    }
    
    .product-original-price {
      color: #999;
      font-size: 12px;
      text-decoration: line-through;
      margin-left: 5px;
    }
    
    .product-tags {
      display: flex;
      gap: 5px;
      margin: 5px 0;
    }
    
    .product-tag {
      background-color: #fff0f0;
      color: #ff4d4f;
      font-size: 12px;
      padding: 2px 6px;
      border-radius: 4px;
    }
    
    .product-sales {
      font-size: 12px;
      color: #999;
    }
    
    .product-action {
      position: absolute;
      right: 10px;
      bottom: 10px;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background-color: #ff4d4f;
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }
    
    /* 样式1 - 网格布局 */
    .grid-products .products-container {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
    }
    
    /* 样式2 - 列表布局 */
    .list-products .product-item {
      display: flex;
      height: 120px;
    }
    
    .list-products .product-image {
      width: 120px;
      height: 120px;
      aspect-ratio: auto;
    }
    
    .list-products .product-info {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    
    /* 样式3 - 卡片布局 */
    .card-products .product-item {
      box-shadow: 0 2px 8px rgba(0,0,0,0.08);
      transition: transform 0.2s;
    }
    
    .card-products .product-item:hover {
      transform: translateY(-2px);
    }
    
    .card-products .products-container {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 15px;
      padding: 15px;
    }
    
    .card-products .product-badge {
      position: absolute;
      top: 10px;
      left: 10px;
      background-color: #ff4d4f;
      color: white;
      font-size: 12px;
      padding: 3px 8px;
      border-radius: 4px;
    }
    
    /* 样式4 - 简约布局 */
    .simple-products .product-item {
      background-color: transparent;
      border-radius: 0;
      margin-bottom: 15px;
    }
    
    .simple-products .product-image {
      border-radius: 8px;
    }
    
    .simple-products .product-info {
      padding: 8px 0;
    }
    
    .simple-products .products-container {
      padding: 15px;
    }
    
    /* 底部导航 */
    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      height: 50px;
      background-color: #fff;
      border-top: 1px solid #eee;
      display: flex;
      z-index: 90;
    }
    
    .bottom-nav-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #666;
      font-size: 10px;
      text-decoration: none;
    }
    
    .bottom-nav-item.active {
      color: #ff4d4f;
    }
    
    .bottom-nav-item i {
      font-size: 20px;
      margin-bottom: 2px;
    }
    
    /* 提示框 */
    .toast {
      position: fixed;
      bottom: 80px;
      left: 50%;
      transform: translateX(-50%);
      background-color: rgba(0,0,0,0.8);
      color: white;
      border-radius: 8px;
      padding: 10px 15px;
      font-size: 14px;
      z-index: 1000;
      display: none;
    }
  </style>
</head>
<body>
  <!-- 提示框 -->
  <div class="toast" id="toast"></div>
  
  <!-- 顶部导航 -->
  <nav class="top-nav">
    <a href="#" class="nav-btn" id="backBtn">
      <i class="fa fa-angle-left"></i>
    </a>
    <h1 class="nav-title">精选商品</h1>
    <a href="#" class="nav-btn primary" id="cartBtn">
      <i class="fa fa-shopping-cart"></i>
    </a>
  </nav>
  
  <!-- 搜索栏 -->
  <div class="search-bar">
    <input type="text" class="search-input" placeholder="搜索商品...">
  </div>
  
  <!-- 样式切换器 -->
  <div class="style-switcher">
    <div class="style-tabs">
      <div class="style-tab active" data-style="grid">网格布局</div>
      <div class="style-tab" data-style="list">列表布局</div>
      <div class="style-tab" data-style="card">卡片布局</div>
      <div class="style-tab" data-style="simple">简约布局</div>
    </div>
  </div>
  
  <!-- 分类筛选 -->
  <div class="category-filter">
    <div class="category-tabs">
      <div class="category-tab active">全部</div>
      <div class="category-tab">服装</div>
      <div class="category-tab">电子产品</div>
      <div class="category-tab">家居</div>
      <div class="category-tab">美妆</div>
      <div class="category-tab">食品</div>
      <div class="category-tab">运动</div>
    </div>
  </div>
  
  <!-- 样式1 - 网格布局 -->
  <div class="products-page active grid-products" id="grid">
    <div class="products-container">
      <div class="product-item">
        <img src="https://picsum.photos/id/26/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-tags">
            <span class="product-tag">热销</span>
          </div>
          <div class="product-title">夏季纯棉短袖T恤 男女同款宽松休闲上衣</div>
          <div>
            <span class="product-price">¥59</span>
            <span class="product-original-price">¥99</span>
          </div>
          <div class="product-sales">月销 2.3k</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/96/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-tags">
            <span class="product-tag">新品</span>
          </div>
          <div class="product-title">无线蓝牙耳机 降噪长续航运动跑步适用</div>
          <div>
            <span class="product-price">¥199</span>
            <span class="product-original-price">¥299</span>
          </div>
          <div class="product-sales">月销 1.5k</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/20/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-tags">
            <span class="product-tag">限时</span>
          </div>
          <div class="product-title">北欧风简约陶瓷花瓶 家居装饰插花摆件</div>
          <div>
            <span class="product-price">¥39</span>
            <span class="product-original-price">¥69</span>
          </div>
          <div class="product-sales">月销 865</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/42/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">天然植物精华面膜 补水保湿提亮肤色</div>
          <div>
            <span class="product-price">¥89</span>
            <span class="product-original-price">¥129</span>
          </div>
          <div class="product-sales">月销 3.1k</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/65/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-tags">
            <span class="product-tag">促销</span>
          </div>
          <div class="product-title">进口零食大礼包 混合口味组合装</div>
          <div>
            <span class="product-price">¥69</span>
            <span class="product-original-price">¥109</span>
          </div>
          <div class="product-sales">月销 1.8k</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/28/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">专业瑜伽垫 防滑健身垫 加厚加宽</div>
          <div>
            <span class="product-price">¥79</span>
            <span class="product-original-price">¥159</span>
          </div>
          <div class="product-sales">月销 956</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 样式2 - 列表布局 -->
  <div class="products-page list-products" id="list">
    <div class="products-container">
      <div class="product-item">
        <img src="https://picsum.photos/id/26/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">夏季纯棉短袖T恤 男女同款宽松休闲上衣</div>
          <div class="product-tags">
            <span class="product-tag">热销</span>
            <span class="product-sales">月销 2.3k</span>
          </div>
          <div>
            <span class="product-price">¥59</span>
            <span class="product-original-price">¥99</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/96/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">无线蓝牙耳机 降噪长续航运动跑步适用</div>
          <div class="product-tags">
            <span class="product-tag">新品</span>
            <span class="product-sales">月销 1.5k</span>
          </div>
          <div>
            <span class="product-price">¥199</span>
            <span class="product-original-price">¥299</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/20/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">北欧风简约陶瓷花瓶 家居装饰插花摆件</div>
          <div class="product-tags">
            <span class="product-tag">限时</span>
            <span class="product-sales">月销 865</span>
          </div>
          <div>
            <span class="product-price">¥39</span>
            <span class="product-original-price">¥69</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/42/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">天然植物精华面膜 补水保湿提亮肤色</div>
          <div class="product-tags">
            <span class="product-sales">月销 3.1k</span>
          </div>
          <div>
            <span class="product-price">¥89</span>
            <span class="product-original-price">¥129</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 样式3 - 卡片布局 -->
  <div class="products-page card-products" id="card">
    <div class="products-container">
      <div class="product-item">
        <div class="product-badge">热销</div>
        <img src="https://picsum.photos/id/26/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">夏季纯棉短袖T恤 男女同款宽松休闲上衣</div>
          <div style="margin-top: 8px;">
            <span class="product-price">¥59</span>
            <span class="product-original-price">¥99</span>
          </div>
          <div class="product-sales">月销 2.3k</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-shopping-cart"></i>
        </div>
      </div>
      
      <div class="product-item">
        <div class="product-badge">新品</div>
        <img src="https://picsum.photos/id/96/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">无线蓝牙耳机 降噪长续航运动跑步适用</div>
          <div style="margin-top: 8px;">
            <span class="product-price">¥199</span>
            <span class="product-original-price">¥299</span>
          </div>
          <div class="product-sales">月销 1.5k</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-shopping-cart"></i>
        </div>
      </div>
      
      <div class="product-item">
        <div class="product-badge">限时</div>
        <img src="https://picsum.photos/id/20/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">北欧风简约陶瓷花瓶 家居装饰插花摆件</div>
          <div style="margin-top: 8px;">
            <span class="product-price">¥39</span>
            <span class="product-original-price">¥69</span>
          </div>
          <div class="product-sales">月销 865</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-shopping-cart"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/42/300/300" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">天然植物精华面膜 补水保湿提亮肤色</div>
          <div style="margin-top: 8px;">
            <span class="product-price">¥89</span>
            <span class="product-original-price">¥129</span>
          </div>
          <div class="product-sales">月销 3.1k</div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-shopping-cart"></i>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 样式4 - 简约布局 -->
  <div class="products-page simple-products" id="simple">
    <div class="products-container">
      <div class="product-item">
        <img src="https://picsum.photos/id/26/600/600" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">夏季纯棉短袖T恤 男女同款宽松休闲上衣</div>
          <div style="margin-top: 5px;">
            <span class="product-price">¥59</span>
            <span class="product-original-price">¥99</span>
            <span class="product-sales" style="margin-left: 10px;">月销 2.3k</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/96/600/600" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">无线蓝牙耳机 降噪长续航运动跑步适用</div>
          <div style="margin-top: 5px;">
            <span class="product-price">¥199</span>
            <span class="product-original-price">¥299</span>
            <span class="product-sales" style="margin-left: 10px;">月销 1.5k</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/20/600/600" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">北欧风简约陶瓷花瓶 家居装饰插花摆件</div>
          <div style="margin-top: 5px;">
            <span class="product-price">¥39</span>
            <span class="product-original-price">¥69</span>
            <span class="product-sales" style="margin-left: 10px;">月销 865</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
      
      <div class="product-item">
        <img src="https://picsum.photos/id/42/600/600" alt="商品图片" class="product-image">
        <div class="product-info">
          <div class="product-title">天然植物精华面膜 补水保湿提亮肤色</div>
          <div style="margin-top: 5px;">
            <span class="product-price">¥89</span>
            <span class="product-original-price">¥129</span>
            <span class="product-sales" style="margin-left: 10px;">月销 3.1k</span>
          </div>
        </div>
        <div class="product-action" onclick="showToast('已加入购物车')">
          <i class="fa fa-plus"></i>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 底部导航 -->
  <div class="bottom-nav">
    <a href="#" class="bottom-nav-item">
      <i class="fa fa-home"></i>
      <span>首页</span>
    </a>
    <a href="#" class="bottom-nav-item active">
      <i class="fa fa-th-large"></i>
      <span>商品</span>
    </a>
    <a href="#" class="bottom-nav-item">
      <i class="fa fa-compass"></i>
      <span>发现</span>
    </a>
    <a href="#" class="bottom-nav-item">
      <i class="fa fa-user"></i>
      <span>我的</span>
    </a>
  </div>
  
  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    // 获取元素
    const styleTabs = document.querySelectorAll('.style-tab');
    const productsPages = document.querySelectorAll('.products-page');
    const categoryTabs = document.querySelectorAll('.category-tab');
    const backBtn = document.getElementById('backBtn');
    const cartBtn = document.getElementById('cartBtn');
    const toast = document.getElementById('toast');
    
    // 样式切换
    styleTabs.forEach(tab => {
      tab.addEventListener('click', function() {
        // 移除所有激活状态
        styleTabs.forEach(t => t.classList.remove('active'));
        productsPages.forEach(page => page.classList.remove('active'));
        
        // 设置当前激活状态
        this.classList.add('active');
        const style = this.getAttribute('data-style');
        document.getElementById(style).classList.add('active');
        
        showToast(`已切换到${this.textContent}`);
      });
    });
    
    // 分类切换
    categoryTabs.forEach(tab => {
      tab.addEventListener('click', function() {
        // 移除所有激活状态
        categoryTabs.forEach(t => t.classList.remove('active'));
        
        // 设置当前激活状态
        this.classList.add('active');
        showToast(`已切换到${this.textContent}分类`);
      });
    });
    
    // 返回按钮
    backBtn.addEventListener('click', function() {
      showToast('返回上一页');
    });
    
    // 购物车按钮
    cartBtn.addEventListener('click', function() {
      showToast('查看购物车');
    });
    
    // 显示提示
    function showToast(message) {
      toast.textContent = message;
      toast.style.display = 'block';
      
      setTimeout(() => {
        toast.style.opacity = '0';
        setTimeout(() => {
          toast.style.display = 'none';
          toast.style.opacity = '1';
        }, 300);
      }, 2000);
    }
  </script>
</body>
</html>
